<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
<head><title>欢迎访问</title>
	<%@include file="../../../web.inc"%>
</head>
<body>
	<form name="dataform1" action="" method="post"></form>
	<button onclick="toUserLoginPage(this)">用户登陆</button>
	<br>
	<button onclick="toEasyUiPage(this)">EasyUi演示</button>
	
	<button onclick="funUserRegister(this)">ajax演示</button>
	<script type="text/javascript">
		function toUserLoginPage() {
			var dform = document.all.dataform1;
			dform.action = "admin/UserLoginAction!initUserLogin.action";
			dform.target = "_self";
			dform.submit();
		}
		function toEasyUiPage() {
			var dform = document.all.dataform1;
			dform.action = "admin/EasyuiDemoAction!queryEasyuiTree.action";
			dform.target = "_self";
			dform.submit();
		}
		
		/********/
		function funUserRegister() {// 用户注册
	$.ajax({
		contentType : "application/x-www-form-urlencoded",
		data : {
			'ajaxDemoVo.userLoginId' : 'admin',
			'ajaxDemoVo.password' : '1111111',
			'ajaxDemoVo.remark':'备注'
		},
		dataType : "json",
		type : "POST",
		timeout : "3000",
		beforeSend : ajaxBeforeSend,
		error : ajaxError,
		success : ajaxSuccess,
		url : "admin/AjaxDemoAction!demo.action"
	});

}

function ajaxSuccess(data) {
	alert("成功：" + data);
	alert("成功：" + data.dataMap);
	alert(JSON.stringify(data));
}

function ajaxError(data) {
	alert("失败");
	alert("失败：" + data.success);
	alert("失败：" + data[0]);
}

function ajaxBeforeSend(data) {
}
	</script>
</body>
</html>